package bishi.jibite;

import java.util.*;

public class demo3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0;i < n;i++) {
            arr[i] = in.nextInt();
        }

        int[] preSum = new int[n + 1];
        for(int i = 1;i <= n;i++) {
            preSum[i] = preSum[i - 1] + arr[i -1];
        }
        //2*preNum[i]-i
        Map<Integer,Integer> map = new HashMap<>();
        map.put(0,0);
        int maxLen = 0;
        int left = 0;
        int right = 0;
        for(int i = 1;i <= n;i++) {
            int target = 2*preSum[i] - i;
            if(map.containsKey(target)) {
                int j = map.get(target);
                int len = i - j;
                if(len > maxLen) {
                    maxLen= len;
                    left = j + 1;
                    right = i;
                }
            }else {
                map.put(target,i);
            }
        }
        System.out.print(left + " " + right);
    }
}
